package com.woniu.factorys;

import com.woniu.entity.Person;
import com.woniu.test.PersonTest;

import java.util.Properties;

/**
 * 造人的工厂
 *
 * @author WenXin
 * @version 1.0
 * @description: TODO
 * @date 2022/8/17 15:47
 */
public class PersonFactory {

    public static Person makePerson() {
        Properties properties = new Properties();
        Person person1 = null;
        try {
            properties.load(PersonFactory.class.getResourceAsStream("../test/person.properties"));
            String person = properties.getProperty("japan");
            person1 = (Person) Class.forName(person).newInstance();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        return person1;
    }
}
